package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.JoinEntity;
import com.lx.oms.controller.manager.JoinManager;
import com.lx.oms.controller.service.JoinService;

/**
 * 加盟申请
 *
 * @author houzhong
 * @date 2018年11月15日 下午3:42:52
 */
@Service("joinService")
public class JoinServiceImpl implements JoinService {

	@Autowired
	private JoinManager joinManager;

	@Override
	public Page<JoinEntity> listJoin(Map<String, Object> params) {
		Query query = new Query(params);
		Page<JoinEntity> page = new Page<>(query);
		joinManager.listJoin(page, query);
		return page;
	}

	@Override
	public R saveJoin(JoinEntity join) {
		int count = joinManager.saveJoin(join);
		return CommonUtils.msg(count);
	}

	@Override
	public R getJoinById(BigInteger id) {
		JoinEntity tJoin = joinManager.getJoinById(id);
		return CommonUtils.msg(tJoin);
	}

	@Override
	public R updateJoin(JoinEntity join) {
		int count = joinManager.updateJoin(join);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = joinManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
